home *** CD-ROM | disk | FTP | other *** search
- Path: watnews.watson.ibm.com!ncohen
- From: ncohen@watson.ibm.com (Norman H. Cohen)
- Newsgroups: comp.lang.ada,comp.lang.c,comp.lang.c++
- Subject: Re: C/C++ knocks the crap out of Ada
- Date: 29 Feb 1996 16:09:05 GMT
- Organization: IBM T.J. Watson Research Center
- Distribution: world
- Message-ID: <4h4j31$1ga3@watnews1.watson.ibm.com>
- References: <JSA.96Feb16135027@organon.com> <4gaa6l$8mk@post.gsfc.nasa.gov> <4gd94r$isu@mack.rt66.com> <1996Feb22.005518.13396@leeweyr.sccsi.com> <4gvrffINNlqo@anvil.ugrad.cs.ubc.ca>
- Reply-To: ncohen@watson.ibm.com
- NNTP-Posting-Host: rios8.watson.ibm.com
-
- In article <4gvrffINNlqo@anvil.ugrad.cs.ubc.ca>, c2a192@ugrad.cs.ubc.ca
- (Kazimir Kylheku) writes:
-
- |> What is intrinsically unsafe about C?
-
- The pitfalls that allow small typographical errors to result in programs
- that compile successfully but behave in a way far different from what was
- intended. (See Koenig's book, for example.)
-
- The lack of sufficient information in a program to perform meaningful
- consistency checks.
-
- The lack of a clear division between the portable and target-specific
- features of the language.
-
- etc.
-
- |> I could write a strict,
- |> standard-conforming, anally-retentive program in any language that could kill
- |> people (maliciously, of course).
-
- But it's easier to do it ACCIDENTALLY in C.
-
- |> Software which has life-threatening consequences shoud not be left to something
- |> that sacrifices intimacy with hardware for some higher purpose that has more to
- |> do with bureaucracy than anything else.
-
- I don't understand this conflict between "intimacy with the hardware" and
- "bureaucracy" or how it relates to programming languages. Indeed, the
- bureaucratic measures wisely imposed on the validation of safety-critical
- software require that the generated machine code be validated along with
- the source code. Perhaps Kazimir Kylheku could explain the conflict he
- perceives.
-
- |> And it should certainly not be written in some poorly standardized language,
- |> for which no two implementations are in agreement. C is governed by an
- |> ISO standard, which, if adhered to, lets a strictly conforming program
- |> translated by a strictly conforming implementation yield well-defined results.
- |>
- |> I don't think you can say the same for Ada or C++.
-
- Ada became an ANSI standard in 1983 and an ISO standard in 1987. A
- revised standard was approved by ISO in 1995.
-
- When someone mentions a language "for which no two implementations are in
- agreement", it is C that springs to mind. Much of the Harbison-Steele
- book is devoted to explaining the distinctions among K&R C, "traditional"
- C (which includes extensions made after 1978), and ANSI C. They describe
- the Bell Labs Portable C Compiler as "a de facto standard for the
- traditional language." I have heard many C programmers express the
- opinion that portability of C programs is best insured by writing in K&R
- C rather than in ANSI C! And then on top of this, we have post-ANSI
- dialects such as GNU C and Microsoft C foisted upon us by those who feel
- they are in a position to impose their own de facto standards. For
- example, in the description of the -pedantic option in section 2.3 of
- "Using GNU CC," Stallman writes:
-
- A feature to report any failure to conform to ANSI C might be useful
- in some instances, but would require considerable additional work and
- would be quite different from '-pedantic'. We recommend, rather,
- that users take advantage of the extensions of GNU C and disregard
- the limitations of other compilers. Aside from certain
- supercomputers and obsolete small machines, thre is less and less
- reason ever to use any other C compiler other than for bootstrapping
- GNU CC.
-
- The culture in the Ada community is quite different. The need to pass a
- rigorous validation suite to be approved for use on U.S. Department of
- Defense projects, and the requirement in the standard itself to reject
- certain forms of nonconformance at compile time, have led compiler
- writers to implement the standard strictly and consistently.
- To the extent that Ada compiler writers have sensed the need for
- extensions, these extensions have been in the form of "changeable parts"
- anticipated by the standard--implementation-defined attributes, pragmas,
- and packages. Many of these implementation variations--for exmaple,
- vendor-specific packages for command-line argument retrieval--have now
- been replaced by standard versions in Ada 95.
-
- --
- Norman H. Cohen ncohen@watson.ibm.com
-